package com.sunxueqi.project.system.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sunxueqi.common.constant.StatusConstants;
import com.sunxueqi.framework.web.vo.BaseVO;

import io.swagger.annotations.ApiModel;

//序列化Json的时候,如果是Null则忽略
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel("系统用户")
public class User extends BaseVO implements Serializable{
	private static final long serialVersionUID = 1L;

	private String id;

	/**
	 * 用户名
	 */
	private String username;

	/**
	 * 用户昵称
	 */
	private String nickname;

	/**
	 * 用户类型（）
	 */
	private String userType;

	/**
	 * 用户邮箱
	 */
	private String email;

	/**
	 * 手机号码
	 */
	private String phone;

	/**
	 * 用户头像
	 */
	private String avatar;

	/**
	 * 用户性别
	 */
	private String gender;

	/**
	 * 密码
	 */
	@JsonIgnore
	private String password;

	/**
	 * 加密盐
	 */
	private String salt;

	/**
	 * 最后登录ip
	 */
	private String loginIp;

	/**
	 * 最后登录时间
	 */
	private Date loginDate;

//	/**
//	 * 角色对象
//	 */
//	private List<Role> roleIds;
	
	/**
	 * 角色id
	 */
	private List<String> roleIds;

	/**
	 * 是否为管理员，是则返回true
	 * 
	 * @return
	 */
	public boolean isAdmin() {
		return isAdmin(this.userType);
	}

	public static boolean isAdmin(String userType) {
		return userType != null && userType.equals(StatusConstants.IS_ADMIN);
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getLoginIp() {
		return loginIp;
	}

	public void setLoginIp(String loginIp) {
		this.loginIp = loginIp;
	}

	public Date getLoginDate() {
		return loginDate;
	}

	public void setLoginDate(Date loginDate) {
		this.loginDate = loginDate;
	}

	public List<String> getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(List<String> roleIds) {
		this.roleIds = roleIds;
	}

//	public List<Role> getRoleIds() {
//		return roleIds;
//	}
//
//	public void setRoleIds(List<Role> roleIds) {
//		this.roleIds = roleIds;
//	}

	
}
